package com.lf.sys.util;

public class MailProperties {

	

	public static MailBean get163MailBean(boolean isSSL) {
		MailBean mailBean = new MailBean();
		mailBean.setSSL(isSSL);
		mailBean.setHostProp("mail.smtp.host");
		mailBean.setHost("smtp.163.com");
		mailBean.setPortProp("mail.smtp.port");
		mailBean.setPort("25");
		mailBean.setProtocolProp("mail.transport.protocol");
		mailBean.setProtocol("smtp");
		if (isSSL) {
			mailBean.setAuthProp("mail.smtp.auth");
			mailBean.setAuth("true");
			mailBean.setSocketFactoryClassProp("mail.smtp.socketFactory.class");
			mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
			mailBean.setSocketFactoryFallbackProp("mail.smtp.socketFactory.fallback");
			mailBean.setSocketFactoryFallback("false");
			mailBean.setSocketFactoryPortProp("mail.smtp.socketFactory.port");
			mailBean.setSocketFactoryPort("465");
			mailBean.setPort("465");
		}
		return mailBean;
	}

	public static MailBean getGoogleMailBean(boolean isPOP3, boolean isSSL) {
		MailBean mailBean = new MailBean();
		mailBean.setSSL(isSSL);
		if (isPOP3) {
			mailBean.setHostProp("mail.pop3.host");
			mailBean.setHost("pop.gmail.com");
			mailBean.setProtocolProp("mail.transport.protocol");
			mailBean.setProtocol("pop3");
			mailBean.setPortProp("mail.pop3.port");
			mailBean.setPort("110");
			if (isSSL) {
				mailBean.setAuthProp("mail.pop3.auth");
				mailBean.setAuth("true");
				mailBean.setSocketFactoryClassProp("mail.pop3.socketFactory.class");
				mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
				mailBean.setSocketFactoryFallbackProp("mail.pop3.socketFactory.fallback");
				mailBean.setSocketFactoryFallback("false");
				mailBean.setSocketFactoryPortProp("mail.pop3.socketFactory.port");
				mailBean.setSocketFactoryPort("995");
				mailBean.setPort("995");
			}
		} else {
			mailBean.setHostProp("mail.imap.host");
			mailBean.setHost("imap.gmail.com");
			mailBean.setProtocolProp("mail.transport.protocol");
			mailBean.setProtocol("imap");
			mailBean.setPortProp("mail.imap.port");
			mailBean.setPort("143");
			if (isSSL) {
				mailBean.setAuthProp("mail.imap.auth");
				mailBean.setAuth("true");
				mailBean.setSocketFactoryClassProp("mail.imap.socketFactory.class");
				mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
				mailBean.setSocketFactoryFallbackProp("mail.imap.socketFactory.fallback");
				mailBean.setSocketFactoryFallback("false");
				mailBean.setSocketFactoryPortProp("mail.imap.socketFactory.port");
				mailBean.setSocketFactoryPort("993");
				mailBean.setPort("993");
			}
		}
		return mailBean;
	}

	public static MailBean getGoogleMailBean(boolean isSSL) {
		MailBean mailBean = new MailBean();
		mailBean.setSSL(isSSL);
		mailBean.setHostProp("mail.smtp.host");
		mailBean.setHost("smtp.gmail.com");
		mailBean.setPortProp("mail.smtp.port");
		mailBean.setPort("25");
		mailBean.setProtocolProp("mail.transport.protocol");
		mailBean.setProtocol("smtp");
		if (isSSL) {
			mailBean.setAuthProp("mail.smtp.auth");
			mailBean.setAuth("true");
			mailBean.setSocketFactoryClassProp("mail.smtp.socketFactory.class");
			mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
			mailBean.setSocketFactoryFallbackProp("mail.smtp.socketFactory.fallback");
			mailBean.setSocketFactoryFallback("false");
			mailBean.setSocketFactoryPortProp("mail.smtp.socketFactory.port");
			mailBean.setSocketFactoryPort("465");
			mailBean.setPort("465");
		}
		return mailBean;
	}

	public static MailBean getYaHooMailBean(boolean isPOP3, boolean isSSL) {
		MailBean mailBean = new MailBean();
		mailBean.setSSL(isSSL);
		if (isPOP3) {
			mailBean.setHostProp("mail.pop3.host");
			mailBean.setHost("pop.mail.yahoo.com");
			mailBean.setProtocolProp("mail.transport.protocol");
			mailBean.setProtocol("pop3");
			mailBean.setPortProp("mail.pop3.port");
			mailBean.setPort("110");
			if (isSSL) {
				mailBean.setAuthProp("mail.pop3.auth");
				mailBean.setAuth("true");
				mailBean.setSocketFactoryClassProp("mail.pop3.socketFactory.class");
				mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
				mailBean.setSocketFactoryFallbackProp("mail.pop3.socketFactory.fallback");
				mailBean.setSocketFactoryFallback("false");
				mailBean.setSocketFactoryPortProp("mail.pop3.socketFactory.port");
				mailBean.setSocketFactoryPort("995");
				mailBean.setPort("995");
			}
		} else {
			mailBean.setHostProp("mail.imap.host");
			mailBean.setHost("imap.mail.yahoo.com");
			mailBean.setProtocolProp("mail.transport.protocol");
			mailBean.setProtocol("imap");
			mailBean.setPortProp("mail.imap.port");
			mailBean.setPort("143");
			if (isSSL) {
				mailBean.setAuthProp("mail.imap.auth");
				mailBean.setAuth("true");
				mailBean.setSocketFactoryClassProp("mail.imap.socketFactory.class");
				mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
				mailBean.setSocketFactoryFallbackProp("mail.imap.socketFactory.fallback");
				mailBean.setSocketFactoryFallback("false");
				mailBean.setSocketFactoryPortProp("mail.imap.socketFactory.port");
				mailBean.setSocketFactoryPort("993");
				mailBean.setPort("993");
			}
		}
		return mailBean;
	}

	public static MailBean getYaHooMailBean(boolean isSSL) {
		MailBean mailBean = new MailBean();
		mailBean.setSSL(isSSL);
		mailBean.setHostProp("mail.smtp.host");
		mailBean.setHost("smtp.mail.yahoo.com");
		mailBean.setPortProp("mail.smtp.port");
		mailBean.setPort("25");
		mailBean.setProtocolProp("mail.transport.protocol");
		mailBean.setProtocol("smtp");
		if (isSSL) {
			mailBean.setAuthProp("mail.smtp.auth");
			mailBean.setAuth("true");
			mailBean.setSocketFactoryClassProp("mail.smtp.socketFactory.class");
			mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
			mailBean.setSocketFactoryFallbackProp("mail.smtp.socketFactory.fallback");
			mailBean.setSocketFactoryFallback("false");
			mailBean.setSocketFactoryPortProp("mail.smtp.socketFactory.port");
			mailBean.setSocketFactoryPort("465");
			mailBean.setPort("465");
		}
		return mailBean;
	}

	public static MailBean getQQMailBean(boolean isPOP3, boolean isSSL) {
		MailBean mailBean = new MailBean();
		mailBean.setSSL(isSSL);
		if (isPOP3) {
			mailBean.setHostProp("mail.pop3.host");
			mailBean.setHost("pop.qq.com");
			mailBean.setProtocolProp("mail.transport.protocol");
			mailBean.setProtocol("pop3");
			mailBean.setPortProp("mail.pop3.port");
			mailBean.setPort("110");
			if (isSSL) {
				mailBean.setAuthProp("mail.pop3.auth");
				mailBean.setAuth("true");
				mailBean.setSocketFactoryClassProp("mail.pop3.socketFactory.class");
				mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
				mailBean.setSocketFactoryFallbackProp("mail.pop3.socketFactory.fallback");
				mailBean.setSocketFactoryFallback("false");
				mailBean.setSocketFactoryPortProp("mail.pop3.socketFactory.port");
				mailBean.setSocketFactoryPort("995");
				mailBean.setPort("995");
			}
		} else {
			mailBean.setHostProp("mail.imap.host");
			mailBean.setHost("imap.qq.com");
			mailBean.setProtocolProp("mail.transport.protocol");
			mailBean.setProtocol("imap");
			mailBean.setPortProp("mail.imap.port");
			mailBean.setPort("143");
			if (isSSL) {
				mailBean.setAuthProp("mail.imap.auth");
				mailBean.setAuth("true");
				mailBean.setSocketFactoryClassProp("mail.imap.socketFactory.class");
				mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
				mailBean.setSocketFactoryFallbackProp("mail.imap.socketFactory.fallback");
				mailBean.setSocketFactoryFallback("false");
				mailBean.setSocketFactoryPortProp("mail.imap.socketFactory.port");
				mailBean.setSocketFactoryPort("993");
				mailBean.setPort("993");
			}
		}
		return mailBean;
	}

	public static MailBean getQQMailBean(boolean isSSL) {
		MailBean mailBean = new MailBean();
		mailBean.setSSL(isSSL);
		mailBean.setHostProp("mail.smtp.host");
		mailBean.setHost("smtp.qq.com");
		mailBean.setPortProp("mail.smtp.port");
		mailBean.setPort("25");
		mailBean.setProtocolProp("mail.transport.protocol");
		mailBean.setProtocol("smtp");
		if (isSSL) {
			mailBean.setAuthProp("mail.smtp.auth");
			mailBean.setAuth("true");
			mailBean.setSocketFactoryClassProp("mail.smtp.socketFactory.class");
			mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
			mailBean.setSocketFactoryFallbackProp("mail.smtp.socketFactory.fallback");
			mailBean.setSocketFactoryFallback("false");
			mailBean.setSocketFactoryPortProp("mail.smtp.socketFactory.port");
			mailBean.setSocketFactoryPort("465");
			mailBean.setPort("465");
		}
		return mailBean;
	}

	public static MailBean getEXQQMailBean(boolean isPOP3, boolean isSSL) {
		MailBean mailBean = new MailBean();
		mailBean.setSSL(isSSL);
		if (isPOP3) {
			mailBean.setHostProp("mail.pop3.host");
			mailBean.setHost("pop.exmail.qq.com");
			mailBean.setProtocolProp("mail.transport.protocol");
			mailBean.setProtocol("pop3");
			mailBean.setPortProp("mail.pop3.port");
			mailBean.setPort("110");
			if (isSSL) {
				mailBean.setAuthProp("mail.pop3.auth");
				mailBean.setAuth("true");
				mailBean.setSocketFactoryClassProp("mail.pop3.socketFactory.class");
				mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
				mailBean.setSocketFactoryFallbackProp("mail.pop3.socketFactory.fallback");
				mailBean.setSocketFactoryFallback("false");
				mailBean.setSocketFactoryPortProp("mail.pop3.socketFactory.port");
				mailBean.setSocketFactoryPort("995");
				mailBean.setPort("995");
			}
		} else {
			mailBean.setHostProp("mail.imap.host");
			mailBean.setHost("imap.exmail.qq.com");
			mailBean.setProtocolProp("mail.transport.protocol");
			mailBean.setProtocol("imap");
			mailBean.setPortProp("mail.imap.port");
			mailBean.setPort("143");
			if (isSSL) {
				mailBean.setAuthProp("mail.imap.auth");
				mailBean.setAuth("true");
				mailBean.setSocketFactoryClassProp("mail.imap.socketFactory.class");
				mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
				mailBean.setSocketFactoryFallbackProp("mail.imap.socketFactory.fallback");
				mailBean.setSocketFactoryFallback("false");
				mailBean.setSocketFactoryPortProp("mail.imap.socketFactory.port");
				mailBean.setSocketFactoryPort("993");
				mailBean.setPort("993");
			}
		}
		return mailBean;
	}

	public static MailBean getEXQQMailBean(boolean isSSL) {
		MailBean mailBean = new MailBean();
		mailBean.setSSL(isSSL);
		mailBean.setHostProp("mail.smtp.host");
		mailBean.setHost("smtp.exmail.qq.com");
		mailBean.setPortProp("mail.smtp.port");
		mailBean.setPort("25");
		mailBean.setProtocolProp("mail.transport.protocol");
		mailBean.setProtocol("smtp");
		if (isSSL) {
			mailBean.setAuthProp("mail.smtp.auth");
			mailBean.setAuth("true");
			mailBean.setSocketFactoryClassProp("mail.smtp.socketFactory.class");
			mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
			mailBean.setSocketFactoryFallbackProp("mail.smtp.socketFactory.fallback");
			mailBean.setSocketFactoryFallback("false");
			mailBean.setSocketFactoryPortProp("mail.smtp.socketFactory.port");
			mailBean.setSocketFactoryPort("465");
			mailBean.setPort("465");
		}
		return mailBean;
	}

	public static MailBean getALIMailBean(boolean isPOP3, boolean isSSL) {
		MailBean mailBean = new MailBean();
		mailBean.setSSL(isSSL);
		if (isPOP3) {
			mailBean.setHostProp("mail.pop3.host");
			mailBean.setHost("pop3.aliyun.com");
			mailBean.setProtocolProp("mail.transport.protocol");
			mailBean.setProtocol("pop3");
			mailBean.setPortProp("mail.pop3.port");
			mailBean.setPort("110");
			if (isSSL) {
				mailBean.setAuthProp("mail.pop3.auth");
				mailBean.setAuth("true");
				mailBean.setSocketFactoryClassProp("mail.pop3.socketFactory.class");
				mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
				mailBean.setSocketFactoryFallbackProp("mail.pop3.socketFactory.fallback");
				mailBean.setSocketFactoryFallback("false");
				mailBean.setSocketFactoryPortProp("mail.pop3.socketFactory.port");
				mailBean.setSocketFactoryPort("995");
				mailBean.setPort("995");
			}
		} else {
			mailBean.setHostProp("mail.imap.host");
			mailBean.setHost("imap.aliyun.com");
			mailBean.setProtocolProp("mail.transport.protocol");
			mailBean.setProtocol("imap");
			mailBean.setPortProp("mail.imap.port");
			mailBean.setPort("143");
			if (isSSL) {
				mailBean.setAuthProp("mail.imap.auth");
				mailBean.setAuth("true");
				mailBean.setSocketFactoryClassProp("mail.imap.socketFactory.class");
				mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
				mailBean.setSocketFactoryFallbackProp("mail.imap.socketFactory.fallback");
				mailBean.setSocketFactoryFallback("false");
				mailBean.setSocketFactoryPortProp("mail.imap.socketFactory.port");
				mailBean.setSocketFactoryPort("993");
				mailBean.setPort("993");
			}
		}
		return mailBean;
	}

	public static MailBean getALIMailBean(boolean isSSL) {
		MailBean mailBean = new MailBean();
		mailBean.setSSL(isSSL);
		mailBean.setHostProp("mail.smtp.host");
		mailBean.setHost("smtp.aliyun.com");
		mailBean.setPortProp("mail.smtp.port");
		mailBean.setPort("25");
		mailBean.setProtocolProp("mail.transport.protocol");
		mailBean.setProtocol("smtp");
		if (isSSL) {
			mailBean.setAuthProp("mail.smtp.auth");
			mailBean.setAuth("true");
			mailBean.setSocketFactoryClassProp("mail.smtp.socketFactory.class");
			mailBean.setSocketFactoryClass("javax.net.ssl.SSLSocketFactory");
			mailBean.setSocketFactoryFallbackProp("mail.smtp.socketFactory.fallback");
			mailBean.setSocketFactoryFallback("false");
			mailBean.setSocketFactoryPortProp("mail.smtp.socketFactory.port");
			mailBean.setSocketFactoryPort("465");
			mailBean.setPort("465");
		}
		return mailBean;
	}

}
